<header class="demo-header">
    <div class="title3Left flt text-center header-small">
        <a href="javascript:history.back(-1);" class="whiteC">
        	<img src="/img/back.png" class="backimg">返回
        </a>
    </div>
    <div class="title3Middle flt text-center">最新发布</div>
    <div class="title3Right flt text-center"></div>
</header>
<div class="graybg new-publish">
    <?php foreach ($this->article_list as $v) { ?>
        <div class="product-list newproduct whitebg" style="border: none;">
            <div style="padding: 15px 0 5px;">
                <div class="imgclass text-center" style="width: 22%;">
                    <img src="<?php echo $v['user']['headimgurl']; ?>" style="height: 50px;width: 50px;border-radius: 50%;"/>
                </div>
                <div class="flt pline" style="padding: 3px 0 0;">
                    <p class="cuxiao-font"><strong><?php echo $v['user']['nickname']; ?></strong></p>
                    <p class="ellipsis product" style="width: 90%;"><?php echo $v['title']?></p>
                </div>
                <div class="fontsize fontC flt padding-top2" style="width: 18%;">
                    <?php echo $v['long_time']; ?>
                </div>
            </div>
            <img src="<?php echo $v['img']?>" class="img-width" />
            <div style="width: 90%; padding-top: 5px;" class="div-center header-small lineheight">
                <?php echo $v['remark']?>...
            </div>
            <div class="big-div paddingnot border1" style="border-bottom: 0;">
                <div><img src="/img/live.png"/>点赞</div>
                <div><a href="/active/comment"><img src="/img/comment.png"/>评论</a></div>
                <div data-id="<?php echo $v['id'];?>" onclick="shareAticle(this)"><img  src="/img/fenxiang_icon.png"/>分享</div>
                <div class="read-amount"><img src="/img/read.png"/>880</div>
            </div>
        </div>
    <?php } ?>
</div>

<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">

    function shareAticle(el) {
        var id = $(el).attr('data-id');
        $.ajax({
            url:'/active/share',
            type:'POST',
            data:{
                id:id
            },
            success:function (res) {
                if(res.code ==200){
                    //console.log(res.result);
                    var items = res.result;
                    wx.config({
                        debug: true,
                        appId: "wx13b0ce87f8202ad4",
                       /* timestamp: items.timestamp,
                        nonceStr: items.wxnonceStr,
                        signature: items.wxSha1,*/
                        timestamp: 1498630966,
                        nonceStr: "anystring",
                        signature: "d0344eda3c19450544b5b9a76f7ba1aebd35bba5",
                        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 功能列表，我们要使用JS-SDK的什么功能
                    });

                    wx.ready(function(){
                        // 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
                        wx.onMenuShareTimeline({
                            title: '分享标题', // 分享标题
                            link:"http://sg.test.renrencaichang.com",
                            imgUrl: "http://sg.test.renrencaichang.com" // 分享图标
                        });
                        // 获取“分享给朋友”按钮点击状态及自定义分享内容接口
                        wx.onMenuShareAppMessage({
                            title: '分享标题', // 分享标题
                            desc: "分享描述", // 分享描述
                            link:"http://sg.test.renrencaichang.com",
                            imgUrl: "http://sg.test.renrencaichang.com", // 分享图标
                            type: 'link', // 分享类型,music、video或link，不填默认为link
                        });
                    });

                }
            }
        });

    }
</script>
